import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'pages/PracticePage.dart';
import 'pages/AnalysisPage.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'Chinese Word Practice',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      getPages: [
        GetPage(name: '/', page: () =>  MyHomePage()),
        GetPage(name: '/practice', page: () =>  PracticePage()),
        GetPage(name: '/analysis', page: () =>  AnalysisPage()),
      ],
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Chinese Word Practice'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
              onPressed: () => Get.toNamed('/practice'),
              child: const Text('开始练习'),
            ),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: () => Get.toNamed('/analysis'),
              child: const Text('查看分析'),
            ),
          ],
        ),
      ),
    );
  }
}